package com.roncoo.education.course.service.dao.impl;

import com.roncoo.education.course.feign.vo.TagVo;
import com.roncoo.education.course.feign.vo.UserTagNameVO;
import com.roncoo.education.course.service.dao.AdvDao;
import com.roncoo.education.course.service.dao.TagDao;
import com.roncoo.education.course.service.dao.impl.mapper.AdvMapper;
import com.roncoo.education.course.service.dao.impl.mapper.TagMapper;
import com.roncoo.education.course.service.dao.impl.mapper.entity.Adv;
import com.roncoo.education.course.service.dao.impl.mapper.entity.AdvExample;
import com.roncoo.education.course.service.dao.impl.mapper.entity.AdvExample.Criteria;
import com.roncoo.education.course.service.dao.impl.mapper.entity.Tag;
import com.roncoo.education.util.base.Page;
import com.roncoo.education.util.base.PageUtil;
import com.roncoo.education.util.tools.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Repository
public class TagDaoImpl implements TagDao {
	@Autowired
	private TagMapper tagMapper;

	@Override
	public int save(Tag record) {
		record.setId(IdWorker.getId());
		return this.tagMapper.insertSelective(record);
	}

	@Override
	public int deleteById(Long id) {
		return this.tagMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int updateById(Tag record) {
		return this.tagMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public Tag getById(Long id) {
		return this.tagMapper.selectByPrimaryKey(id);
	}
	
	@Override
	public List<TagVo> findByTag() {
		return tagMapper.findByTag();
	}

	@Override
	public ArrayList<UserTagNameVO> getUserTagName(List<Long> tagId) {
		return tagMapper.getUserTagName(tagId);
	}

}
